import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'  //静态导入

//路由懒加载
const Home = () => import('../views/Home.vue')



Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/homePage',  // 重定向:重新指向其它path,会改变网址
    children:[
      {
        path:'homePage',
        name:'homePage',
        component:()=>import('../views/homePage.vue')
      },{
        path:'goods',
        name:'goods',
        component:()=>import('../views/goods.vue')
      },{
        path:'about',
        name:'about',
        component:()=>import('../views/about.vue')
      },
      {
        path:'detailsPage',
        name:'detailsPage',
        component:()=>import('../views/detailsPage.vue')
      },
      {
        path:'cat',
        name:'cat',
        component:()=>import('../views/cat.vue')
      },
      {
        path:'Collection',
        name:'Collection',
        component:()=>import('../views/Collection.vue')
      },
      {
        path:'order',
        name:'order',
        component:()=>import('../views/order.vue')
      },
      {
        path:'ConfirmOrder',
        name:'ConfirmOrder',
        component:()=>import('../views/ConfirmOrder.vue')
      },
      {
        path:'hasMenubutton',
        name:'hasMenubutton',
        component:()=>import('../views/hasMenubutton.vue')
      },

    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  // {
  //   path: '*',
  //   redirect: '/login'
  // },
]
const router = new VueRouter({
  routes
})
//路由守卫-进行全局路由拦截




export default router
